package com.appspot.action;

import java.io.IOException;
import java.util.logging.Logger;

import javax.servlet.ServletException;

import net.sourceforge.stripes.action.ActionBean;
import net.sourceforge.stripes.action.ActionBeanContext;
import net.sourceforge.stripes.action.DefaultHandler;
import net.sourceforge.stripes.action.ForwardResolution;
import net.sourceforge.stripes.action.RedirectResolution;
import net.sourceforge.stripes.action.Resolution;
import net.sourceforge.stripes.action.UrlBinding;

import com.appspot.twit.TwitSession;

@UrlBinding("/Welcome.action")
public class WelcomeActionBean implements ActionBean {
	private static final String VIEW = "/template/welcome.jsp";
	private ActionBeanContext ctx;
	private static final Logger logger = Logger
	.getLogger(WelcomeActionBean.class.getName());

	
	
	
	
	@DefaultHandler
	public void welcome() {
		TwitSession twitSession = new TwitSession();
		
		try {
			//twitSession.getOAuthToken(this.ctx);
			twitSession.signIn(ctx);
		} catch (ServletException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	
	public ActionBeanContext getContext() {
		return this.ctx;
	}

	public void setContext(ActionBeanContext arg0) {
		this.ctx = arg0;
	}
	
}
